package Listener;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;

import Util.MODE;


public class ModeListener implements Listener{
	private String[] mode;
	private Text text;
	private Composite composite;

	public ModeListener(String[] mode, Text text, Composite composite){
		this.mode = mode;
		this.text = text;
		this.composite = composite;
	}

	@Override
	public void handleEvent(Event event) {
		if(event.type == SWT.Selection){
			mode[MODE.MODE] = event.widget.getData().toString();

			if(mode[MODE.MODE].equals(MODE.TEXT)){
				text.setVisible(true);
			}
			else{
				text.setVisible(false);
			}
			if(mode[MODE.MODE].equals(MODE.SHAPE)){
				composite.setVisible(true);
			}
			else{
				composite.setVisible(false);
			}
		}
	}
}
